package com.mlnx.push.websocket;

import com.alibaba.fastjson.JSON;
import com.mlnx.push.TopicFactory;
import com.mlnx.push.websocket.server.topic.TopicType;
import com.mlnx.push.websocket.server.topic.UserTopic;

/**
 * Created by amanda.shan on 2019/10/31.
 */
public class WebsocketTopicFactory implements TopicFactory {

    @Override
    public String getHeartTopic(Integer patientId) {
        return JSON.toJSONString(new UserTopic(TopicType.U_ECG_HEART_TOPIC, patientId));
    }

    @Override
    public String getEcgDeviceInfoTopic(Integer patientId) {
        return JSON.toJSONString(new UserTopic(TopicType.U_ECG_DEVICE_TOPIC, patientId));
    }

    @Override
    public String getRealAnalyTopic(Integer patientId) {
        return JSON.toJSONString(new UserTopic(TopicType.U_ECG_REAL_ANALY_TOPIC, patientId));
    }

    @Override
    public String getBpTopic(Integer patientId) {
        return JSON.toJSONString(new UserTopic(TopicType.U_BP_TOPIC, patientId));
    }

    @Override
    public String getSpoTopic(Integer patientId) {
        return JSON.toJSONString(new UserTopic(TopicType.U_SPO_TOPIC, patientId));
    }

    @Override
    public String getSugarTopic(Integer patientId) {
        return JSON.toJSONString(new UserTopic(TopicType.U_SUGAR_TOPIC, patientId));
    }

    @Override
    public String getDeviceState(Integer patientId) {
        return JSON.toJSONString(new UserTopic(TopicType.U_DEVICE_EXIGENCE_TOPIC, patientId));
    }
}
